package com.example.demo.imgAudit;

import java.util.*;

/**
 * @Author: zjq
 * @Date: create in 2023/2/3 9:22
 */
public class chinatele {

    public static String ImgCensor() {
        // 请求url
        String url = "http://182.42.255.14:8502/ai";
        try {
            // 本地文件路径
            String filePath = "I:\\java\\22.jpg,I:\\java\\11.jpg";

            List<String> imgData = Arrays.asList(filePath.split(","));

            //byte[] imgData = FileUtil.readFileByBytes(filePath);
            //String imgStr = Base64.getUrlEncoder().encodeToString(imgData);
            //String imgParam = URLEncoder.encode(imgStr, "UTF-8");
            //System.out.println(imgParam);

            Map<String, Object> querys = new HashMap<String, Object>();
            querys.put("Action", "ImgAudit");

            List<String> subTask = new ArrayList<String>();
            subTask.add("porn");
            subTask.add("terror");
            subTask.add("public");
            querys.put("SubTask", subTask);

            querys.put("AppKey", "ImgAudit");//your_email
            querys.put("Token", "ImgAudit");//your_token

            querys.put("ImageURL", imgData);
            System.out.println(querys);

            String json = querys.toString();
            System.out.println(json);
            //String result = HttpUtil.postJSON(url, json);

            return null;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void main(String[] args) {
        chinatele.ImgCensor();
    }
}
